package com.jinke.api.modules.app.enums;

import com.baomidou.mybatisplus.annotation.EnumValue;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
import lombok.Getter;

@Getter
public enum ValidateStatus {

    UN_VALIDATE(0, "未验证"),
    RESIDENTIAL(1, "住宅"),
    UN_RESIDENTIAL(2, "非住宅"),
    ;


    @EnumValue
    @JsonValue
    private final int value;
    private final String desc;

    ValidateStatus(final int value, final String desc) {
        this.value = value;
        this.desc = desc;
    }

    @JsonCreator(mode = JsonCreator.Mode.DELEGATING)
    public static ValidateStatus defaultEnum(Boolean value) {
       if(value == null){
           return UN_VALIDATE;
       }else if(value){
           return RESIDENTIAL;
       }else{
           return UN_RESIDENTIAL;
       }
    }

}